import {baseUrl} from "@/config/env";
import startSearchModel from "@/config/startSearchModel";
import avueOptionTools from "@/config/avueOptionTools";


export const dateTypes = [
    {label: 'String', value: 'java.lang.String'},
    {label: 'Integer', value: 'java.lang.Integer'},
    {label: 'Long', value: 'java.lang.Long'},
    {label: 'Short', value: 'java.lang.Short'},
    {label: 'Double', value: 'java.lang.Double'},
    {label: 'Float', value: 'java.lang.Float'},
    {label: 'Boolean', value: 'java.lang.Boolean'},
    {label: 'Byte', value: 'java.lang.Byte'},
    {label: 'Character', value: 'java.lang.Character'},
    {label: 'Date', value: 'java.util.Date'},
    {label: 'LocalTime', value: 'java.time.LocalTime'},
    {label: 'LocalDateTime', value: 'java.time.LocalDateTime'},
    {label: 'LocalDate', value: 'java.time.LocalDate'},
]
export const formFieldHandlerState = {
    display: [
        {label: "可见", value: true},
        {label: "不可见", value: false}
    ],
    disabled: [
        {label: "可用", value: false},
        {label: "禁用", value: true}
    ],
    search: [
        {label: "启用", value: true},
        {label: "禁用", value: false}
    ],
    hide: [
        {label: "隐藏", value: true},
        {label: "显示", value: false}
    ],
    required: [
        {label: "是", value: true},
        {label: "否", value: false}
    ],
    searchModels: startSearchModel.getDict(),
}
export const dynamicStoreType = [
    {label: "物理存储", value: 'physical_storage', desc: '存储到数据库中'},
    {label: "JSON存储", value: 'json_storage', desc: '存储到当前数据表中'}
]


export default [
    {
        title: '布局字段',
        list: [
            {
                type: 'group',
                label: '分组',
                icon: 'icon-group',
                display: true,
                arrow: false,
                collapse: true,
                children: {
                    column: []
                }
            },
            {
                type: 'dynamic',
                label: '子表单',
                icon: 'icon-table',
                span: 24,
                storeType: 'physical_storage',
                display: true,
                children: {
                    align: 'center',
                    headerAlign: 'center',
                    addBtn: true,
                    delBtn: true,
                    column: []
                }
            },
            {
              type: 'title',
              icon: 'icon-title',
              span: 24,
              display: true,
              styles: {
                fontSize: '18px',
                color: '#000'
              },
              label: '标题',
              labelWidth: '0px',
              value: '标题',
            }
        ]
    },
    {
        title: '文本输入',
        list: [
            {
                searchLabelWidth: 120,
                type: 'input',
                label: '单行文本',
                icon: 'icon-input',
                span: 24,
                display: true
            },
            {
                type: 'password',
                searchLabelWidth: 120,
                label: '密码',
                icon: 'icon-password',
                span: 24,
                display: true
            },
            {
                type: 'textarea',
                searchLabelWidth: 120,
                label: '多行文本',
                icon: 'icon-textarea',
                span: 24,
                display: true
            },

        ]
    },
    {
        title: "数字类型",
        list: [
            {
                type: 'number',
                searchLabelWidth: 120,
                label: '整数',
                icon: 'icon-number',
                min: 0,
                controls: true,
                span: 24,
                display: true,
                sqlDisabled: true,
                precision: 0,
            },
            {
                type: 'number',
                searchLabelWidth: 120,
                label: '带小数',
                icon: 'icon-number',
                sqlDataType: "decimal",
                sqlDataLength: 8,
                precision: 2,
                sqlDisabled: false,
                min: 0,
                controls: true,
                span: 24,
                display: true,
            },
        ]
    },
    {
        title: '选择字段',
        list: [
            {
                type: 'radio',
                label: '单选框组',
                icon: 'icon-radio',
                searchLabelWidth: 120,
                systemDictData: false,
                dicData: [
                    {label: '选项一', value: '0'},
                    {label: '选项二', value: '1'},
                    {label: '选项三', value: '2'},
                ],
                span: 24,
                display: true,
                dicOption: 'static',
                props: {
                    label: 'label',
                    value: 'value'
                }
            },
            {

                type: 'checkbox',
                label: '多选框组',
                searchLabelWidth: 120,
                icon: 'icon-checkbox',
                systemDictData: false,
                dicData: [
                    {label: '选项一', value: '0'},
                    {label: '选项二', value: '1'},
                    {label: '选项三', value: '2'},
                ],
                span: 24,
                display: true,
                dicOption: 'static',
                props: {
                    label: 'label',
                    value: 'value'
                }
            },
            {
                type: 'select',
                label: '下拉选择器',
                icon: 'icon-select',
                searchLabelWidth: 120,
                systemDictData: false,
                dicData: [
                    {label: '选项一', value: "0"},
                    {label: '选项二', value: "1"},
                    {label: '选项三', value: "2"},
                ],
                // 用于做级联配置
                cascaderItem: [],
                span: 24,
                display: true,
                dicOption: 'static',
                props: {
                    label: 'label',
                    value: 'value'
                }
            },
            {
                type: 'cascader',
                searchLabelWidth: 120,
                label: '级联选择器',
                icon: 'icon-link',
                span: 24,
                display: true,
                dicData: [
                    {
                        label: '选项一',
                        value: "0",
                        children: [
                            {
                                label: '选项1-1',
                                value: "11",
                            },
                            {
                                label: '选项1-2',
                                value: "12",
                            }
                        ]
                    },
                    {label: '选项二', value: 1},
                    {label: '选项三', value: 2},
                ],
                cascaderIndex: 1,
                showAllLevels: true,
                dicOption: 'static',
                separator: "/",
                props: {
                    label: 'label',
                    value: 'value'
                }
            },
            {

                type: 'tree',
                label: '树形选择器',
                icon: 'icon-tree',
                searchLabelWidth: 120,
                span: 24,
                display: true,
                dicOption: 'static',
                dicData: [
                    {
                        label: '选项一',
                        value: "0",
                        children: [
                            {
                                label: '选项1-1',
                                value: "11",
                            },
                            {
                                label: '选项1-2',
                                value: "12",
                            }
                        ]
                    },
                    {label: '选项二', value: "1"},
                    {label: '选项三', value: "2"},
                ],
                parent: true,
                props: {
                    label: 'label',
                    value: 'value'
                }
            },
            {

                type: 'switch',
                label: '开关',
                icon: 'icon-switch',
                span: 24,
                searchLabelWidth: 120,
                display: true,
                value: 0,
                dicData: [
                    {label: '', value: '0'},
                    {label: '', value: '1'}
                ]
            },
            {

                type: 'rate',
                label: '评价',
                icon: 'icon-star',
                span: 24,
                display: true,
                max: 5,
                searchLabelWidth: 120,
                value: 0,
                texts: ['极差', '失望', '一般', '满意', '惊喜'],
                colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
            },
            {

                type: 'slider',
                label: '滑块',
                icon: 'icon-slider',
                span: 24,
                display: true,
                searchLabelWidth: 120,
                min: 0,
                max: 10
            },
            {

                type: 'color',
                label: '颜色选择器',
                icon: 'icon-color',
                searchLabelWidth: 120,
                span: 24,
                display: true
            },
            {

                type: 'map',
                component: 'avue-input-map',
                label: '地图选择器',
                icon: 'icon-map',
                searchLabelWidth: 120,
                span: 24,
                display: true
            }
        ]
    },
    {
        title: '日期时间字段',
        list: [
            {
                type: 'year',
                label: '年',
                icon: 'icon-year',
                span: 24,
                searchLabelWidth: 120,
                display: true,
                format: 'yyyy',
                valueFormat: 'yyyy',

            },
            {
                type: 'month',
                label: '月',
                icon: 'icon-month',
                span: 24,
                display: true,
                searchLabelWidth: 120,
                format: 'MM',
                valueFormat: 'MM',
            },
            {
                type: 'week',
                label: '周',
                icon: 'icon-week',
                span: 24,
                display: true,
                format: 'yyyy 第 WW 周',
                searchLabelWidth: 120,
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
            },
            {
                type: 'date',
                label: '日期',
                icon: 'icon-date',
                span: 24,
                display: true,
                format: 'yyyy-MM-dd',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
            },
            {
                type: 'time',
                label: '时间',
                icon: 'icon-time',
                span: 24,
                display: true,
                searchLabelWidth: 120,
                format: 'HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
            },
            {
                type: 'datetime',
                label: '日期时间',
                icon: 'icon-datetime',
                span: 24,
                searchLabelWidth: 120,
                display: true,
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',

            },
        ],
    },
    {
        title: '上传字段',
        list: [
            {
                type: 'upload',
                label: '上传',
                icon: 'icon-upload',
                span: 24,
                display: true,
                showFileList: true,
                dataType: 'object',
                multiple: true,
                searchLabelWidth: 120,
                // props: {},
                limit: 10,
                propsHttp: avueOptionTools.upload.propsHttp,
                canvasOption: {},
                headersConfig: [],
                dataConfig: [],
                action: avueOptionTools.upload.action
            }
        ],
    },
    {
        title: '插件字段（富文本需要单独引入）',
        list: [
            {
                type: 'ueditor',
                component: 'avue-ueditor',
                label: '富文本',
                icon: 'icon-richtext',
                searchLabelWidth: 120,
                span: 24,
                display: true,
                action: baseUrl + `/infra/file/upload`,
                propsHttp: {
                    home: '',
                    res: '',
                    url: 'url',
                },
                options: {
                    action: baseUrl + `/infra/file/upload`,
                    propsHttp: {
                        home: '',
                        res: '',
                        url: 'url',
                    },
                }
            }
        ],
    },
]

